home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / BGETB.C < prev    next >
Text File  |  1991-09-23  |  2KB  |  61 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)bgetb.c    1.5 - 91/09/23" */
  5.  
  6. #include <ansi.h>
  7.  
  8. /* ansi headers */
  9. #ifdef AC_STDDEF
  10. #include <stddef.h>
  11. #endif
  12.  
  13. /* local headers */
  14. #include "blkio_.h"
  15.  
  16. /*man---------------------------------------------------------------------------
  17. NAME
  18.      bgetb - get a block from a block file
  19.  
  20. SYNOPSIS
  21.      #include <blkio.h>
  22.  
  23.      int bgetb(bp, bn, buf)
  24.      BLKFILE *bp;
  25.      bpos_t bn;
  26.      void *buf;
  27.  
  28. DESCRIPTION
  29.      The bgetb function reads block number bn from the block file
  30.      associated with BLKFILE pointer bp.  buf must point to a storage
  31.      area at least as large as the block size for bp.  Block numbering
  32.      starts at 1.
  33.  
  34.      bgetb will fail if one or more of the following is true:
  35.  
  36.      [EINVAL]       bp is not a valid BLKFILE pointer.
  37.      [EINVAL]       bn is less than 1.
  38.      [EINVAL]       buf is the NULL pointer.
  39.      [BEEOF]        There are not bn blocks in the file.
  40.      [BENOPEN]      bp is not open for reading.
  41.  
  42. SEE ALSO
  43.      bgetbf, bgeth, bputb.
  44.  
  45. DIAGNOSTICS
  46.      Upon successful completion, a value of 0 is returned.  Otherwise,
  47.      a value of -1 is returned, and errno set to indicate the error.
  48.  
  49. ------------------------------------------------------------------------------*/
  50. #ifdef AC_PROTO
  51. int bgetb(BLKFILE *bp, bpos_t bn, void *buf)
  52. #else
  53. int bgetb(bp, bn, buf)
  54. BLKFILE *bp;
  55. bpos_t bn;
  56. void *buf;
  57. #endif
  58. {
  59.     return bgetbf(bp, bn, (size_t)0, buf, bp->blksize);
  60. }
  61.